package com.unitedvision.persistence.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.unitedvision.persistence.domain.CompanyCustomerEntity;
import com.unitedvision.persistence.domain.CompanyEntity;
import com.unitedvision.persistence.domain.OperatorEntity;
import com.unitedvision.persistence.domain.TransactionEntity;

public interface TransactionRepository extends JpaRepository<TransactionEntity, Integer> {
	List<TransactionEntity> findByOperator(OperatorEntity operator);
	List<TransactionEntity> findByCompanyCustomer(CompanyCustomerEntity customer);
	@Query ("Select t from TransactionEntity t where t.operator.company = ?1 and t.transactionDate = ?2")
	List<TransactionEntity> findByTransactionDateAndCompany(Date date, CompanyEntity company);
	@Query ("Select t from TransactionEntity t where t.operator.company = ?1")
	List<TransactionEntity> findByCompany(CompanyEntity company);
}
